LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2011, 01:47 PM   #1
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
http authentication with libxml2


Hi,
I'm trying to add HTTP authentication to my app (it's a rss reader). As the app is in written in C and uses Libxml2, I've been searching in Libxml2 doc, but it seems it's not possible. Maybe someone could point me to a link to relevant info about how I could achieve that?
Thanks.
 
Old 05-30-2011, 11:16 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

This has been unanswered for a few days; perhaps I can help:

1. As you probably know, "HTTP Authentication" is a simple protocol where the server challenges the client for username and password. Here's more info:
http://en.wikipedia.org/wiki/Basic_a...authentication

2. HTTP authentication is supported automatically by most servers (certainly by Apache and IIS), and most browsers (IE, Firefox, Safari, etc etc). So it's a "given" that most web servers and most web clients will probably be able to negotiate HTTP Authentication.

Sooooooooo .....

3. If your C/libXML2 application runs completely independent of any web server (if it opens its open sockets and listens on its own port), you'll probably have to "roll your own" authentication mechanism. It isn't hard - the Wikipedia link above should get you pointed in the right direction.

4. If (as is more likely) your application is invoked by a standard web server (e.g. it's called from an HTML web page served by an Apache server) - then it's REALLY easy. You just write an .htaccess file for the directory with your HTML.

It's really as simple as that

'Hope that helps .. PSM
 
Old 05-31-2011, 12:00 AM   #3
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Original Poster
Rep: Reputation: 43
In my app, the user enter a RSS feed URL. Then this URL is processed first by libXML2, which is reponsible for downloading and parsing the remote resource. So, the app doesn't deal directly with socket. It only passes the URL to libxml2 then get a downloaded file.

So, if I'm right, it could be enough to just pass a string like, for instance: "http://" ( "user : password" ) base64-encoded @ "rss-news.com/feed1.xml" to libxml2.

Of course, I'm going to try that out. Thanks!

Last edited by manu-tm; 06-06-2011 at 06:29 AM.
 
Old 06-04-2011, 10:23 AM   #4
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Original Poster
Rep: Reputation: 43
If I may ask another question, I'd like to add proxy server support too. I could find a lot of doc on proxy server itself but not on how applications can implement that.
Thanks again.
 
Old 06-04-2011, 11:55 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,647
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
Is your application responsible for the entire HTTP transaction, or is it being invoked by a web-server, e.g. as a dedicated virtual host?

(And if not, why not?)
 
Old 06-04-2011, 12:24 PM   #6
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Original Poster
Rep: Reputation: 43
Yes, the user selects a feed URL, then the URL is passed to libxml2 which downloads and parses it. It's a client application. What I wanted to know is how proxy server info (host name and port number) is supposed to be used/sent by the app. I just read about suffix proxy where proxy info is passed in the URL.

Last edited by manu-tm; 06-06-2011 at 06:52 AM.
 
Old 06-06-2011, 06:57 AM   #7
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Original Poster
Rep: Reputation: 43
From your answers and after more search, everything I need is documented in the HTTP protocol so I'm going to do that with socket programming. Thanks paulsm4 and sundialsvcs.

Last edited by manu-tm; 06-15-2011 at 07:25 AM. Reason: solved
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
execute a webtest with basic http authentication using perl's http::webtest mariogarcia Programming 1 04-07-2009 02:05 AM
how to setup a http authentication proxy bluesurfer Linux - Networking 1 06-06-2007 02:47 AM
mod_rewrite *and* http authentication belorion Linux - General 0 01-20-2005 04:05 PM
Authentication In A Http Request With Kerberos Ephraim Programming 0 08-03-2004 04:13 AM
HTTP AUTHENTICATION with PHP lemotion Programming 1 04-22-2004 02:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration