Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract URL Params from HTML Form #1

Open
zenwong opened this issue Feb 10, 2012 · 3 comments
Open

extract URL Params from HTML Form #1

zenwong opened this issue Feb 10, 2012 · 3 comments

Comments

@zenwong
Copy link

zenwong commented Feb 10, 2012

Hi there, I've been trying to extract the url parameters from a HTML form with your library. I am ale to get extract the params using jansson to extract the QUERY param from the return req->headers. So when I do curl -X POST 'localhost/form?title=TITLE&desc=DESC&date=DATE' i am able to get back title desc and date. But when I submit my html form it doesn't seem to pick up the query params, not sure what I'm supposed to put in the html form action.

the html form

the netstring
======NETSTRING======

54c6755b-9628-40a4-9a2d-cc82a816345e 2 /form 622:{"PATH":"/form","x-forwarded-for":"127.0.0.1","cache-control":"max-age=0","origin":"http://dev.l","content-type":"application/x-www-form-urlencoded","accept-language":"en-US,en;q=0.8","accept-encoding":"gzip,deflate,sdch","connection":"keep-alive","content-length":"72","referer":"http://dev.l/","accept-charset":"ISO-8859-1,utf-8;q=0.7,*;q=0.3","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7","host":"dev.l","METHOD":"POST","VERSION":"HTTP/1.1","URI":"/form","PATTERN":"/form"},72:title=sdgfsdfg&desc=fdsgsdf&tDate=10-1-2012,

as you can see theres no QUERY field.

@xrl
Copy link
Owner

xrl commented Feb 10, 2012

That HTML form in your example is not complete. Did it have a title, desc, and Date field?

Mongrel2 request netstrings have two parts: a) headers, b) body. The body in this example is "72:title=sdgfsdfg&desc=fdsgsdf&tDate=10-1-2012,". I that your data?

@xrl
Copy link
Owner

xrl commented Feb 10, 2012

That HTML form in your example is not complete. Did it have a title, desc,
and Date field?

Mongrel2 request netstrings have two parts: a) headers, b) body. The body
in this example is "72:title=sdgfsdfg&desc=fdsgsdf&tDate=10-1-2012,". I
that your data?

On Thu, Feb 9, 2012 at 10:30 PM, zenwong <
[email protected]

wrote:

Hi there, I've been trying to extract the url parameters from a HTML form
with your library. I am ale to get extract the params using jansson to
extract the QUERY param from the return req->headers. So when I do curl -X
POST 'localhost/form?title=TITLE&desc=DESC&date=DATE' i am able to get back
title desc and date. But when I submit my html form it doesn't seem to
pick up the query params, not sure what I'm supposed to put in the html
form action.

the html form

the netstring
======NETSTRING======
54c6755b-9628-40a4-9a2d-cc82a816345e 2 /form
622:{"PATH":"/form","x-forwarded-for":"127.0.0.1","cache-control":"max-age=0","origin":"
http://dev.l
","content-type":"application/x-www-form-urlencoded","accept-language":"en-US,en;q=0.8","accept-encoding":"gzip,deflate,sdch","connection":"keep-alive","content-length":"72","referer":"
http://dev.l/","accept-charset":"ISO-8859-1,utf-8;q=0.7,*;q=0.3","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","user-agent":"Mozilla/5.0
(X11; Linux x86_64) AppleWebKit/535.7 (KHTML, like Gecko)
Chrome/16.0.912.77

Safari/535.7","host":"dev.l","METHOD":"POST","VERSION":"HTTP/1.1","URI":"/form","PATTERN":"/form"},72:title=sdgfsdfg&desc=fdsgsdf&tDate=10-1-2012,

as you can see theres no QUERY field.


Reply to this email directly or view it on GitHub:
#1

@zenwong
Copy link
Author

zenwong commented Feb 10, 2012

ya that's my data, the html form had the correct form fields. whenever i try posting from the html form, it seems I get the query string in the body part.

<label for"title">Title :

  <label for"desc">Desc :</label>
  <input id="desc" type="text" name="desc" /><br />

  <label for"date">Date :</label>
  <input id="date" type="text" name="date" /><br />

  <label for"actress">Actress :</label>
  <input id="actress" type="text" name="actress" /><br />

  <label for"tags">Tags :</label>
  <input id="tags" type="text" name="tags" /><br />

those are the form fields, i've omitted the rest of the html structure in this post, but it is in there in my html file. I just wanted to show what data has been submitted after the html form is submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants