World: r3wp
[CGI] web server issues
older newer | first last |
Josh 23-Feb-2007 [645] | I get an access error when I try to set the IDs, so it seems not possible... |
Graham 23-Feb-2007 [646] | more likely you're in the wrong directory. |
Gabriele 23-Feb-2007 [647x2] | you can't change the owner of a file, unless you are root |
what's the easiest thing to do is.... delete those files from the script :) | |
Chris 23-Feb-2007 [649x5] | You shouldn't need to open a file port to set-modes, just set-modes %file.r [... modes ...] |
Also, I don't know if this is so with every setup, but when you create a file with a CGI script, the process owner, not the script owner, is the owner of the file, so you'd need to be able to do owner-read/owner-write. I usually set owner/group/world-read/write to true and execute to false. | |
I built this into my Sandbox port... | |
(see 'Files' group) | |
The process owner depends on the httpd config, right? | |
Gabriele 24-Feb-2007 [654] | yes; and if you use SuExec the process owner becomes the script owner (i.e. your user id), but SuExec is tricky business. |
Maxim 26-Feb-2007 [655] | is it possible to extract/change a cookie from the site a plugin is working in? I have embedded an app within an IIS served web site. I must make the reblet interact with the site's cookie, so it follows the rest of the site's status when relaunched (browsing to/from the app from other pages restarts the rebol app). |
Oldes 26-Feb-2007 [656] | google "javascript cookies tutorial" and use rebol to call javascript to get the cookies |
Maxim 26-Feb-2007 [657] | thanks this will get me going :-) |
btiffin 19-Apr-2007 [658] | Hi, question for the webheads. In short. Can a form call a cgi action that processes data but doesn't output any Content-type (or anything for that matter) without the browser status coming up with "waiting for reply". I've got a client that wants a form for requesting more info, but they want to leave the user on the same screen, so I thought I could have a %process.cgi that takes the data and plays with it and then have an intrinsic onsubmit=alert(...) to inform the user that the request has been submitted. The %process.cgi doesn't print "Content-type ..." it doesn't print anything, as I was hoping to leave the same browser screen up. Am I living in lalaland? Should the %process.cgi just redirect back to the original page with? print "location: /original.html^/content-type: text/html^/" or is that deprecated now? It works under my test heads, Cheyenne and nonIE browser, but is there a bigger better way? Or do I tell the client that the browser needs a new page and I can add a back link (not preferred). Thanks for listening |
Sunanda 19-Apr-2007 [659] | You could try sending back a 204 response. Means "no content" in the response. No idea what a webserver would do with that. A 205 might work too. |
Gabriele 19-Apr-2007 [660x2] | why should not the user leave the form? should a user be able to send it multiple times? |
if you need to rely on JS, you could do an xmlhttp request... | |
btiffin 19-Apr-2007 [662x4] | I'm popping up an Alert... This is a client request, I'm looking at options. Thanks for the hints. |
The form comes with a note about Javascript...so far anyway. I'm showing off the print "location: " umm, redirect, to them right now as we speak. | |
I'll reinform them of the potential problems of having this type of form on their page. | |
And thanks to %blog.r's abuse? code, I should be able to stop most of the potential harm...but I'm still reiterating this to the client. | |
DanielSz 25-Jul-2007 [666] | Hello, I need to send multipart/form-data to a server for uploading a file from the console. I've been googling and searching the script archive, to no avail. Can anyone help? |
btiffin 25-Jul-2007 [667] | Daniel; Try http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=cgi.r for some code. And http://www.rebol.net/cookbook/recipes/0026.htmlfor a REBOL sample solution and then wait for the rest of the forum members to pipe up with 'bigger better' solutions, and they will. :) |
DanielSz 25-Jul-2007 [668] | Thanks for the help. The recipe from the rebol cookbook show you how to upload a file provided the server runs a rebol script too. The server I'm uploading a file to doesn't. It expects multipart/form-data. Maybe the %cgi.r by Cal Dixon provides a solution. I'll investigate further. More hints will be appreciated, as well... |
btiffin 25-Jul-2007 [669] | Try this ML thread http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlKVSQ and some notes by Sunanda on CGI 'safety' http://www.rebol.org/cgi-bin/cgiwrap/rebol/art-display-article.r?article=x60 |
DanielSz 25-Jul-2007 [670x2] | In that ML thread, the request was to handle a multipart upload on the server side (in rebol). I need to perform a multipart upload on the client side (in rebol). As for the seconde link, unfortunately I get "Article x60 is no longer available ". Any idea? |
In other words, the rebol script has to send values to a form on the server issuing something like that in the header: Content-Type: multipart/form-data; boundary=----------6l5Xq9lJYPaaypknAH8Des etc. Surely someone has done this before (I hope)... | |
btiffin 25-Jul-2007 [672x2] | My bad. http://www.rebol.org/cgi-bin/cgiwrap/rebol/art-display-article.r?article=x60w but unfortunately this article skips over the info for multipart/form. |
Try http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlRDSC But to be honest, I've been waiting for Graham or Dockimbel to notice the conversation. My exposure to this sequence is purely "little think cut'n'paste" from the cookbook, since I'm REBOL in, REBOL out for the website I run. :) | |
Graham 25-Jul-2007 [674x2] | Oldes' script looks like it should do the job. |
this is an article I wrote in 2003 hacking the http protocol to do this too http://www.compkarori.com/vanilla/display/HTTP+file+uploading | |
DanielSz 26-Jul-2007 [676] | Thanks, Graham, you hit the right spot. Like you say in your article, "Read/Custom sets the port to lines modes, and there is no clean way to change this to binary for binary uploads". But that's exactly what I need. Which script by Oldes are you referring to? Where can I find it? Are you saying that his is doing the job? |
btiffin 26-Jul-2007 [677] | The last ML entry I mentioned has the reference to Olde's script. rmlRDSC If it does the job of tweaking the lines mode? Haven't looked. |
Graham 26-Jul-2007 [678x2] | I don't know if it helps, but I did write a web server stress test that did a http upload of hundreds of images in Rebol that year.. but the scripts are long lost. |
I used a variant of the http-tools.r script, composed the correct header, and then insert the headers, and then switched the port to binary before inserting the payload | |
DanielSz 26-Jul-2007 [680x2] | Ok, I'll try to hack the http-tools.r, see if I can get anything done. I saw a script written in python claiming to do multipart uploads, but I hope I can get it working in Rebol, which for me is always first choice. |
Thanks everybody. I'll keep you posted. | |
Volker 26-Jul-2007 [682x3] | what are you doing? still uploading binary? then use open/insert/close and change port to binary if it is open |
hmm, does open/custom do that. i hope.. | |
i guess i am on the wrong track.. | |
DanielSz 26-Jul-2007 [685] | I played with Oldes script a bit, didn't get far. I think there's no other option than follow Graham's advice and delve in the http scheme. I had hoped to find something in the script archive, oh well... I saw that even in the Ruby and Python community there's some confusion on how to achieve multipart form submissions with CGI. (Python default http library also uses "application/x-www-form-urlencoded" and not ""multipart/form-data", but there's a library called HTTPFileUploader that does the job). Last time I tried to hack the http scheme I wasn't so succesful. This time, if I need help, I'll ask for help. |
Volker 26-Jul-2007 [686] | do you need to write binary, or a multipart?could be multipart can use base64. then its somewhat bigger, but has no problems with text-mode. could even be that multipart of email works the same. in that case there is 'build-attach-body. |
DanielSz 26-Jul-2007 [687x3] | The script should be able to post a multipart form as described in rfc1867. It should be able to post a number of fields, for example: Content-Disposition: form-data; name="userid", and finally it should be able to upload a file in binary data. |
Graham described what needs to be done (I used a variant of the http-tools.r script, composed the correct header, and then insert the headers, and then switched the port to binary before inserting the payload). Only it's a little a bit above my capacities. In other words, I'll need two weeks to do it, if I ever manage it. | |
Graham, I'm a big fan of http-tools.r (I believe you wrote it,right?). I used it in my DYNdns client that I wrote in Rebol. I realized only recently that some of the functionality was built-in.(Basic authenticaion with read/custom). Grrrr... if only you hadn't thrown those upload scripts away :) | |
Graham 26-Jul-2007 [690] | Daniel, I wrote http-tools.r before there was a read/custom .. that's how old the script is! |
DanielSz 26-Jul-2007 [691] | Yeah, I remember some tips you contributed to the rebolzine on posting to web forms, way back... Anyway, I think I won't tinker with the http scheme, kinda dpressing thought, especially since I have great hopes to achieve what I need using curl and the shell capability of Rebol. Let curl do that work, afte r all, that's what' it's meant to do best. |
Graham 26-Jul-2007 [692x2] | I found the script .. written in 2002. |
Undocumented .. but basically it took a directory of jpegs and zip files and uploaded them to a java based webserver that required custom headers | |
DanielSz 26-Jul-2007 [694] | Great, can I see it? |
older newer | first last |